-------------------------------------------------------- ServerActivity -------------------------------------


---------- ServerActivity_Create
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ServerActivity_Create]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
	drop procedure [dbo].[ServerActivity_Create]
GO

CREATE PROCEDURE [dbo].[ServerActivity_Create]
	@occurred datetime,
	@conversationGuid uniqueidentifier,
	@method varchar(200),
	@detail varchar(300),
	@context varchar(500),
	@id integer OUTPUT
AS
	INSERT INTO [dbo].[ServerActivity]
	(
		[OCCURRED],
		[CONVERSATION_GUID],
		[METHOD],
		[DETAIL],
		[CONTEXT]
	)
	VALUES
	(
		@occurred,
		@conversationGuid,
		@method,
		@detail,
		@context
	)
	
	SET @id = SCOPE_IDENTITY();
GO
/*
DECLARE @id integer
DECLARE @occurred datetime
SET @occurred = GETDATE()
EXEC [dbo].[ServerActivity_Create] @occurred, 'method', 'context', @id=@id OUTPUT
SELECT @id

delete from  [dbo].[ServerActivity]

select 
	[ID],
	[OCCURRED],
	[CONVERSATION_GUID],
	[METHOD],
	[DETAIL],
	[CONTEXT]
from  [dbo].[ServerActivity] 
group by 		
	[ID],
	[OCCURRED],
	[CONVERSATION_GUID],
	[METHOD],
	[DETAIL],
	[CONTEXT]
*/
